<?php
namespace Api\Controller;
use Think\Controller;

class JobwantController extends BaseController {

   private $m = NULL;
   private $md = NULL;
   private $navName = '订单管理';


   public function _initialize(){
   		parent::_initialize();
		$this->m = M('customer_jobwant');
		$this->md = M('shop_detail');
		
		
   }
    	 	
	/**   聚餐美食-猜你喜欢  liuq
	*
	*/	
  
   public  function slist(){
     $page  = I('page');//页码
       //$cid = I('cid');//  用户标识  member id
     $data = $this->m->where()->order('add_time desc')->page($page.',10')->select(); 
     $count_num = $this->m->where('add_time desc')->order('add_time desc')->count();
  
       foreach( $data as $key => $item){
       
           $data1[$key]['id'] = $item['id']; 
             $data1[$key]['title'] = $item['title'];
               $data1[$key]['require'] = $item['require'];
                 $data1[$key]['add_time'] = $item['add_time'];
                  $data1[$key]['intro'] = $item['intro'];
                     
                  }
                 
                //  dump($data1);exit;
    returnApiData3('0','成功',$data1, $data2,$data3,$count_num);exit;	      
       
   }
   
   
   public  function  add_jobwant(){
      $info['cid'] =  I('cid');
      $info['title'] =  I('title');
      $info['require']  = I('require');
      $info['intro'] = I('intro');
      $info['add_time'] = time();
      $result =  $this->m->add($info);
      if( $result ){
          
            returnApiresult("0", "成功");exit;
          
      }
       
   } 
   
 public  function  edit_jobwant(){
     
      $id  = I('id');
      $dataInfo = $this->m->where('id="'.$id.'"')->find();
      $data['id'] = $dataInfo['id']; // 下一个  编辑之后的 保存的接口用到
      $data['title'] = $dataInfo['title'];
      $data['require'] = $dataInfo['require'];
      $data['intro'] = $dataInfo['intro'];
      
      returnApiData2('0','成功',$data, $data2,$data3);exit;
     
 } 
           
           
 public function   save_jobwant(){
    $id  = I('id');
    $info['title'] = I('title');
    $info['require'] = I('require'); 
    $info['intro'] = I('intro');
    $result = $this->m->where('id="'.$id.'"')->save($info);
    if(  $result ){
        
          returnApiresult("0", "修改成功");exit;
          
    }
    
 }
   
   
   
 public  function  del_jobwant(){
    $id = I('id');
    $result = $this->m->where('id="'.$id.'"')->delete(); 
        if(  $result ){
             returnApiData("0","删除成功");exit;

         }
 }
     

}